<%-- 
    Document   : Inscription
    Created on : 11 mai 2012, 15:49:51
    Author     : user
--%>

<%@page import="session.SalleSession"%>
<%@page import="session.SalleSessionLocal"%>
<%@page import="javax.naming.InitialContext"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>

<head><title>Inscription</title></head>

<body bgcolor="white">
<center>
    <h1> Inscription </h1>
<p>
<form method="post" action="/ProjetJeu-war/Inscription.jsp">
<table border=10>
  <tr>
    <td>Pseudo : </td>
    <td><input type="text" name="pseudo" size="25" value=""></td>
  </tr>
  <tr>
    <td>Mail : </td>
    <td><input type="text" name="mail" size="25" value=""></td>
  </tr>
  <tr>
    <td>Mot de passe : </td>
    <td><input type="password" name="mdp" size="25" value=""></td>
  </tr>
</table>
<p>
<input type="submit" name="submit" value="S'inscrire">

</form>

<%
String pseudo = request.getParameter("pseudo");
String mail = request.getParameter("mail");
String mdp = request.getParameter("mdp");

if (pseudo != null && !"".equals(pseudo) && mdp != null && !"".equals(mdp)) {
        InitialContext ic = new InitialContext();
    Object o = ic.lookup("java:global/ProjetJeu/ProjetJeu-ejb/SalleSession!session.SalleSessionLocal");
   
        SalleSessionLocal salle = (SalleSessionLocal) o;
        boolean b =salle.inscription(pseudo, mail, mdp);
        if(b){
%>

<jsp:forward page="index.jsp" ></jsp:forward>

<%
        }else{
 %>

 <p style="color: red"> L'inscription n'a pas été faite</p>

<%           
        }
    
}
%>

<hr>
[<a href="index.jsp">Retour à la page d'accueil </a>]
</center>
</body>
</html>